/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author WinKiQue58
 */
@Entity
@Table(name = "ENTERPRISE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Enterprise.findAll", query = "SELECT e FROM Enterprise e"),
    @NamedQuery(name = "Enterprise.findByIdEnterprise", query = "SELECT e FROM Enterprise e WHERE e.idEnterprise = :idEnterprise"),
    @NamedQuery(name = "Enterprise.findByName", query = "SELECT e FROM Enterprise e WHERE e.name = :name")})
public class Enterprise implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_ENTERPRISE")
    private BigInteger idEnterprise;
    @Size(max = 180)
    @Column(name = "NAME")
    private String name;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "enterprise", fetch = FetchType.LAZY)
    private List<BranchEnterprise> branchEnterpriseList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "enterprise", fetch = FetchType.LAZY)
    private List<ProductType> productTypeList;

    public Enterprise() {
    }

    public Enterprise(BigInteger idEnterprise, String name) {
        this.idEnterprise = idEnterprise;
    }

    public BigInteger getIdEnterprise() {
        return idEnterprise;
    }

    public void setIdEnterprise(BigInteger idEnterprise) {
        this.idEnterprise = idEnterprise;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlTransient
    public List<BranchEnterprise> getBranchEnterpriseList() {
        return branchEnterpriseList;
    }

    public void setBranchEnterpriseList(List<BranchEnterprise> branchEnterpriseList) {
        this.branchEnterpriseList = branchEnterpriseList;
    }

    @XmlTransient
    public List<ProductType> getProductTypeList() {
        return productTypeList;
    }

    public void setProductTypeList(List<ProductType> productTypeList) {
        this.productTypeList = productTypeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEnterprise != null ? idEnterprise.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Enterprise)) {
            return false;
        }
        Enterprise other = (Enterprise) object;
        if ((this.idEnterprise == null && other.idEnterprise != null) || (this.idEnterprise != null && !this.idEnterprise.equals(other.idEnterprise))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Enterprise[ idEnterprise=" + idEnterprise + " ]";
    }
    
}
